﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DE_MVC_WyFy.Areas.Administrator.Models;
using DE_MVC_WyFy.Models;

namespace DE_MVC_WyFy.Controllers
{
	public class HomeController : Controller
	{
		public ActionResult Index()
		{
			ViewBag.Message = "Welcome to DevExpress Extensions for ASP.NET MVC!";

			List<ProductType> listPrType = ProductType.Objects.All().ToList();
			List<ProductType> prodID;
			prodID = ProductType.Objects.Find(c => c.ProductTypeName == "Thời trang nam").ToList();
			List<Product> listProd = ProductModel.ProductForMen(true);
			ViewBag.ThoiTrangNam = listProd;
			List<Product> listProdForFemale = ProductModel.ProductForMen(false);
			ViewBag.ThoiTrangNu = listProdForFemale;
			ViewData["LsProd"] = listProdForFemale;
			return View(listPrType);
		}
		public PartialViewResult GetSlideImage()
		{
			List<SlideImages> slider = SlideImages.Objects.All().ToList();
			return PartialView(slider);
		}
		public ActionResult Detail(string category)
		{
			return View();
		}
		public ActionResult Search([Bind(Prefix = "id")] string pro)
		{

			if (!string.IsNullOrEmpty(pro))
			{
				var lsPro = Product.Objects.Find(c => c.Name.Contains(pro)).ToList();
				return View(lsPro);
			}
			else
				return Redirect("Index");
		}
		public PartialViewResult ProductSummary(Object lsprod)
		{

			return PartialView(lsprod);
		}
	}
}
